var baseURL = "http://192.168.4.18:3000"
function httpPromise({
    url
}){
    return new Promise((resolve,reject)=>{
        wx.request({
            url: baseURL+url,
            data: {},
            method: 'GET',
            success: function(res){
                // success
                resolve(res)
            },
            fail: function() {
                // fail
                reject(res)
            }
        })
    })
}
function getCatHttp(){
    return httpPromise({
        url:"/top/playlist?cat=华语"
    })
}
function getHomeHttp(){
    return httpPromise({
        url:"/program/recommend"
    })
}

module.exports = {
    getCatHttp,
    getHomeHttp
}